from django.db import models

# Create your models here.


class Author(models.Model):
    name = models.CharField(max_length=100)
    password = models.CharField(max_length=100)

    class Meta:
        db_table = "作者表"

    def __str__(self):
        return self.name


class Books(models.Model):
    title = models.CharField(max_length=100)
    content = models.TextField()
    # img = models.ImageField()
    author = models.ForeignKey(Author, on_delete=models.CASCADE)

    class Meta:
        db_table = "书籍表"

    def __str__(self):
        return self.title
